<%--
  Created by IntelliJ IDEA.
  User: 20459
  Date: 2023/4/13
  Time: 11:17
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!doctype html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>后台登录-X-admin1.1</title>
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
  <link rel="stylesheet" href="../x-admin/css/font.css">
  <link rel="stylesheet" href="../x-admin/css/xadmin.css">
  <link rel="stylesheet" href="https://cdn.bootcss.com/Swiper/3.4.2/css/swiper.min.css">
  <script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
  <script type="text/javascript" src="https://cdn.bootcss.com/Swiper/3.4.2/js/swiper.jquery.min.js"></script>
  <script src="../x-admin/lib/layui/layui.js" charset="utf-8"></script>
  <script type="text/javascript" src="../x-admin/js/xadmin.js"></script>

</head>
<body>
<form class="layui-form">
  <div class="layui-form-item">
    <label for="level-id" class="layui-form-label">
      详情id
    </label>
    <div class="layui-input-inline">
      <input type="text" id="level-id" name="level-id" disabled="" value="${sxid}" class="layui-input">
    </div>
  </div>
  <div class="layui-form-item">
    <label for="level-name" class="layui-form-label">
      <span class="x-red">原价</span>
    </label>
    <div class="layui-input-inline">
      <input type="text" id="level-name" name="level-name" required="" lay-verify="required"
             autocomplete="off" value="${xprice}" class="layui-input">
    </div>
  </div>
  <div class="layui-form-item">
    <label for="level-kiss" class="layui-form-label">
      <span class="x-red">现价修改为</span>
    </label>
    <div class="layui-input-inline">
      <input type="text" id="level-kiss" name="level-kiss" required="" value="" lay-verify="required"
             autocomplete="off" class="layui-input">
    </div>
  </div>
  <div class="layui-form-item">
    <div  class="layui-btn" lay-filter="save" lay-submit="" onclick="changeprice()">
      保存
    </div>
  </div>
</form>


<script>
  function changeprice(){
    console.log("修改价格的ajax！")
    var element = document.querySelector("#level-id");
    var sid = element.value;
    var element1 = document.querySelector("#level-kiss");
    var price = element1.value;
    if (price!=""){
    $.ajax({
      url:"/goodsxqedit?v=changeprice",
      type:"post",
      data:{
        sid,
        price,
      },
      success:(r=>{
        if (r>0){
          layer.msg("修改成功！",{icon:1,time:1000},function () {
            // 获得frame索引
            var index = parent.layer.getFrameIndex(window.name);
            //关闭当前frame
            parent.layer.close(index);
            //修改成功后刷新父界面
            window.parent.location.reload();
          });
        }else{
          layer.msg("修改失败！",{icon:2})
        }

      })
    })
    }else {
      console.log("price为空！")
    }
  }
  //百度统计可去掉
  var _hmt = _hmt || [];
  (function() {
    var hm = document.createElement("script");
    hm.src = "https://hm.baidu.com/hm.js?b393d153aeb26b46e9431fabaf0f6190";
    var s = document.getElementsByTagName("script")[0];
    s.parentNode.insertBefore(hm, s);
  })();
</script>
</body>
</html>
